package org.mca.mcaweb.util;

import i18n.MsgUtil;

import javax.faces.application.FacesMessage.Severity;

public class McawebException extends Exception {
	
	private static final long serialVersionUID = 1L;
	/**
	 * @param message
	 * @param cause
	 */
	private Severity severity;
	private String friendlyMessage;

	public Severity getSeverity() {
		return severity;
	}

    public McawebException() {
    	super();
    }

	public McawebException(String friendlyMessage, Throwable cause, Severity severity) {
		super(cause);
		this.friendlyMessage = friendlyMessage;
		this.severity = severity;
		tratarMensagem();
	}

	public McawebException(String friendlyMessage, Severity severity) {
		this.friendlyMessage = friendlyMessage;
		this.severity = severity;
	}

	public String getFriendlyMessage() {
		return friendlyMessage;
	}

	protected void tratarMensagem() {
		MsgUtil.addMessage(this);
	}


}
